#include "histoTest.h"
using namespace std;


HistoTest::HistoTest()
{
}
 
void HistoTest::setUp()
{
}

void HistoTest::tearDown()
{
}

void HistoTest::testHisto()
{
	float t0 = 40;
	float t1 = 30;
	float t2 = 20;
	float t3 = 10;
	size_t s1 = 1500;	
	
	DnaSeq * l1 = createList(s1, 24, t0, t1, t2, t3);

	srand (time(NULL));
	int length = 5;
	for (int j=0; j<1500; j+=100)
	{
		for (int i=0; i<100; ++i)
		{
			l1[j+i].len = length;
		}
		length += 5;
	}

	Histogram H(l1,s1);
	H.writeData("../data/data");

	map<int,int> m = H.getMap();
	for(auto p : m)
	{
		CPPUNIT_ASSERT( p.second == 100 );
	}
	
}

void HistoTest::testEqual()
{
	// test provisoire
	float t0 = 40;
	float t1 = 30;
	float t2 = 20;
	float t3 = 10;
	size_t s1 = 10;	
	
	DnaSeq * l1 = createList(s1, 24, t0, t1, t2, t3);
	Histogram H(l1,s1);
	Histogram I(l1,s1);
	l1[8].len = 23;
	Histogram J(l1,s1);


	CPPUNIT_ASSERT( H == I);
	CPPUNIT_ASSERT( !(H == J));
	H = J;
	CPPUNIT_ASSERT(H == J);

}